// npm install uuid
import { v4 as uuidv4 } from 'uuid';

// 要随机生成一个字符串且每次执行不发生变化， 游客身份持久存储
export const getUuidToken = () => {
    // 先获取看有没有，
    let uuid_token = localStorage.getItem('UUIDTOKEN');
    if (!uuid_token) {
        uuid_token = uuidv4()
        localStorage.setItem('UUIDTOKEN', uuid_token)
    }
    return uuid_token
}